#include <iostream>
#include <string>
#include <cstring>
using namespace std;
int t, a, b, c, d;
char s[10];
int opr(int sum, int f, int idx){
	switch(idx){
		case 0:
			sum += f;
			break;
		case 1:
			sum -= f;
			break;
		case 2:
			sum *= f;
						
	}
	return sum;
}

char fh(int i){
	switch(i){
		case 0:
			return '+';
		case 1:
			return '-';
		case 2:
			return '*';
	}
}
int main(){
	cin >> t;
	while(t--){
		cin >> a >> b >> c >> d;
		memset(s, 0, 10); 
		int flag = 0;
		for (int i = 0; i < 3; i++){
			int ans = a;
			ans = opr(ans, b, i);
			for (int j = 0; j < 3; j++){
				ans = opr(ans, c, j);
				for (int z = 0; z < 3; z++){
					ans = opr(ans, d, z);
					if (ans == 24){
					flag = 1;
					s[0] = a + '0';
					s[1] = fh(i);
					s[2] = b + '0';
					s[3] = fh(j);
					s[4] = c + '0';
					s[5] = fh(z);
					s[6] = d + '0';
					break;
			       }
			   }
			}
			
		}
		if (flag){
			for (int i = 0; i < 7; i++) cout << s[i];
		}
		else cout << -1 << endl;
		
		
	}
	return 0;
} 
